Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: console output to a file #1632

Merged
merged 12 commits into from
May 31, 2022
Merged

feat: console output to a file #1632

merged 12 commits into from
May 31, 2022

Conversation

rhythmrx9
Copy link
Contributor

closes #1631

@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2022

Codecov Report

Merging #1632 (f352971) into main (9a49015) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1632      +/-   ##
==========================================
- Coverage   78.66%   78.63%   -0.04%     
==========================================
  Files         296      296              
  Lines        6141     6173      +32     
  Branches     1002     1003       +1     
==========================================
+ Hits         4831     4854      +23     
- Misses       1093     1101       +8     
- Partials      217      218       +1     
Flag Coverage Δ
longtests 78.63% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cve_bin_tool/output_engine/__init__.py 58.37% <ø> (ø)
cve_bin_tool/output_engine/console.py 96.87% <100.00%> (+0.40%) ⬆️
test/test_output_engine.py 94.88% <100.00%> (+0.69%) ⬆️
cve_bin_tool/nvd_api.py 75.20% <0.00%> (-8.80%) ⬇️
test/test_cli.py 81.39% <0.00%> (+0.38%) ⬆️
cve_bin_tool/cli.py 72.26% <0.00%> (+0.42%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Contributor

@anthonyharrison anthonyharrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhythmrx9 You need to update the test suite to show that the routine works with both a console and file output. output_console is explicitly called in test_output_engine - I suspect we don't want that now and I wonder if you should rename the fucntion _output_console to show that it is an internal function and shouldn't be called explicitly outside of the module,

@rhythmrx9
Copy link
Contributor Author

You're right, the function should be renamed. Will add tests as well, thanks.

@rhythmrx9 rhythmrx9 marked this pull request as draft April 9, 2022 17:50
@rhythmrx9 rhythmrx9 marked this pull request as ready for review April 10, 2022 13:43
@@ -61,7 +61,23 @@ def format_version_range(version_info: VersionInfo) -> str:
return "-"


def output_console(
def output_console_wrap(*args):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should this have a type hint for args?

@rhythmrx9
Copy link
Contributor Author

Also, should this have a type hint for args?

All positional arguments have a different type, so *args would be of the type Any, will make changes.

Copy link
Contributor

@terriko terriko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently my comment got left in pending... but I'd like to change the main function name back to output_console so that it matches the informal api we have going with output_html and output_json

@@ -61,7 +61,23 @@ def format_version_range(version_info: VersionInfo) -> str:
return "-"


def output_console(
def output_console_wrap(*args):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of nitpicky but... I think we should leave the "public" function as output_console in order to match output_html and the others. Makes a better API that way, although it's sort of an informal one. You could rename the internal one to _output_console_nowrap or something to make it more clear.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should this have a type hint for args?

@rhythmrx9
Copy link
Contributor Author

resolved merge conflicts and updated the branch.

Copy link
Contributor

@terriko terriko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Console output to a file
4 participants